/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ui;

import excom.JBoxEvent;
import excom.JBoxEventListener;
import javax.swing.JFrame;
import javax.swing.event.EventListenerList;

/**
 *
 * @author pmchanh
 */
public class AbstractFrame extends JFrame{
    protected javax.swing.event.EventListenerList listenerList = new EventListenerList();
    public void addJBoxListener(JBoxEventListener mel) {
       listenerList.add(JBoxEventListener.class, mel);
    }

    public void removeJBoxListener(JBoxEventListener mel) {
        listenerList.remove(JBoxEventListener.class, mel);
    }

    protected void addJBoxEvent(JBoxEvent be){
        Object[] listeners = listenerList.getListenerList();
        for(int i = 0; i < listeners.length; i+= 2)
            if(listeners[i] == JBoxEventListener.class)
                ((JBoxEventListener)listeners[i+1]).myJBoxEvent(be);
    }

}
